<template>
    <el-form :model="formData" ref="form" :rules="rules" label-width="80px" :inline="false">
        <el-form-item label="岗位名称">
            <el-input v-model="formData.postName" placeholder="请输入岗位名称"></el-input>
        </el-form-item>
        <el-form-item label="岗位编码">
            <el-input v-model="formData.postCode" placeholder="请输入岗位编码"></el-input>
        </el-form-item>
        <el-form-item label="岗位顺序">
            <el-input-number v-model="formData.postSort" :min="1" :max="10" controls-position="right" size="large" />
        </el-form-item>
        <!-- 岗位状态 -->
        <el-form-item label="状态">
            <el-radio-group v-model="formData.status">
                <el-radio value="1">正常</el-radio>
                <el-radio value="0">停用</el-radio>
            </el-radio-group>
        </el-form-item>
        <el-form-item label="备注">
            <el-input v-model="formData.remark" type="textarea" placeholder="请输入内容" :rows="3" />
        </el-form-item>
        <el-form-item>
            <el-button type="primary" @click="onSubmit">立即创建</el-button>
            <el-button @click="close">取消</el-button>
        </el-form-item>
    </el-form>

</template>

<script setup>
import { ref,defineEmits } from 'vue'
import request from '@/api/request'
let emit = defineEmits(['ref-table'])

let formData = ref({
    postSort: 1
})
let onSubmit = () => {
    console.log(formData.value);
    request({
        method:"post",
        url:"/system/permission/post/insert",
        data:formData.value
    }).then(resp=>{
        emit('ref-table')
    })
}
let close = () => {
    emit('ref-table')
}
</script>

<style scoped></style>
